import request from '@/utils/request'

// 获取传感器列表
export const getSiteList = () => {
  return request({
    url: '/site',
    method: 'get'
  })
}

// 删除传感器
export const deleteSite = (siteId) => {
  return request({
    url: `/site/${siteId}`,
    method: 'delete'
  })
}

// 添加传感器
export const addSite = (data) => {
  return request({
    url: '/site',
    method: 'post',
    data
  })
}

// 修改传感器
export const updateSite = (data) => {
  return request({
    url: '/site',
    method: 'put',
    data
  })
}

// 根据site_id查询
export const getSiteById = (siteId) => {
  return request({
    url: `/site/${siteId}`,
    method: 'get'
  })
}

// 根据room_id查询
export const getSiteByRoomId = (roomId) => {
  return request({
    url: `/site/room/${roomId}`,
    method: 'get'
  })
} 